/*
 * @Author: zi.yang
 * @Date: 2021-04-10 10:48:18
 * @LastEditors: zi.yang
 * @LastEditTime: 2021-04-29 14:48:35
 * @Description: In User Settings Edit
 * @FilePath: \take-out-food\src\router\index.js
 */
import Vue from 'vue';

import VueRouter from 'vue-router';

import Goods from '@components/goods';
import Ratings from '@components/ratings';
import Seller from '@components/seller';
import Home from '@views/Home.vue';

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    children: [
      {
        path: '/',
        name: 'default', // 默认跳转
        redirect: '/goods',
      },
      {
        path: '/goods',
        name: 'Goods',
        component: Goods,
      },
      {
        path: '/seller',
        name: 'Seller',
        component: Seller,
      },
      {
        path: '/ratings',
        name: 'Ratings',
        component: Ratings,
      },
    ],
  },
];

const router = new VueRouter({
  routes,
  scrollBehavior() {
    return { x: 0, y: 0 };
  },
});

export default router;
